//
//  YAEmoticon.swift
//  表情键盘[练习]
//
//  Created by 鱼龙之梦 on 15/9/11.
//  Copyright © 2015年 panyanzhi. All rights reserved.
//

import UIKit
/// 表情符号模型
class YAEmoticon: NSObject {
///  表情文字
    var chs:String?
///  表情图片名称
    var png:String?
///  图像完整路径
    var imagePath:String {
        return (png != nil) ? NSBundle.mainBundle().bundlePath + "/Emoticons.bundle/" + png! : ""
    }
    var code:String?{
        didSet{
            //读取16进制的数值
            let scanner = NSScanner(string: self.code!)
            var value: UInt32 = 0
            scanner.scanHexInt(&value)
            emoji = String(Character(UnicodeScalar(value)))
        }
    }
    var emoji:String?//转换成[]字符串
///  删除按钮标记
    var isRemove = false
///  空白标记
    var isEmpty = false
    ///  表情使用频率
   var times = 0
    //注意：搞两个标记的构造函数
    init(isEmpty:Bool){
        super.init()
        self.isEmpty = isEmpty
    }
    init(isRemove:Bool) {
        super.init()
        self.isRemove = isRemove
    }
     //MARK:--- 字典转模型
    init(keyedValues: [String : AnyObject]) {
        super.init()
        setValuesForKeysWithDictionary(keyedValues)
    }
    override func setValue(value: AnyObject?, forUndefinedKey key: String) {
        //
    }
     //MARK:--- 打印调试用
    override var description:String{
        let keys = ["chs","png","code","isRemove","isEmpty"]
        return dictionaryWithValuesForKeys(keys).description
    }
}
